//
//  Student.m
//  手动内存管理
//
//  Created by FelixYin on 2020/4/12.
//  Copyright © 2020 FelixYin. All rights reserved.
//

#import "Student.h"

@implementation Student{
    Dog *_dog;
}

//自动生成成员变量和属性的setter,getter实现
@synthesize age = _age123;


- (void)setAge:(NSInteger)age{
    _age123 = age;
}

- (void)setDog:(Dog *)dog{
    if (dog != _dog) {
        [_dog release]; //赋值之前，先释放之前的对象
        _dog = [dog retain];
    }
}

- (Dog *)getDog{
    return _dog;
}


- (void)dealloc
{
    NSLog(@"Student === Dealloc");
    [_dog release];
    [super dealloc];
}

@end
